package cn.itsource.flyingcar.exception;

import cn.itsource.flyingcar.constants.ErrorCode;
import lombok.Data;

//全局异常
@Data
public class GlobalException extends RuntimeException{

    //用来把错误码传递给JsonResult对象
    private int code;

    public GlobalException(String message,int code){
        super(message);
        this.code = code;
    }
    // 错误码异常
    public GlobalException(ErrorCode errorCode){
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
    }

    //字符串异常
    public GlobalException(String message){
        super(message);
    }
}
